package Polymorphic02;

/**
 *
 * 测试
 *
 */
public class Test {

    public static void all(Animal animal){
       animal.jump();
    }

    public static void main(String[] args) {
        Animal animal=new Animal();
        animal.jump();

        Cats cats=new Cats("Tom",10,"男");
        cats.jump();
        cats.eat();

        Dogs dogs=new Dogs("旺财",10,"男");
        dogs.jump();
        dogs.eat();

        Kangaroo kangaroo =new Kangaroo("小小",20,"男");
        kangaroo.jump();
        kangaroo.boxing();

//        Animal animal1=new Cats();
//        animal1.jump();


//        if (animal1 instanceof Cats) {
//            Cats cats1 = (Cats) animal1;
//            cats1.eat();
//        } else if (animal1 instanceof Dogs) {
//            Dogs dogs1 = (Dogs) animal1;
//            dogs1.eat();
//        } else {
//            System.out.println("类型错误");
//        }

          all(animal);
          all(cats);
          all(dogs);
          all(kangaroo);


    }

}
